// scroll decorator
import { View } from '@doctorwork/components';

export default function () {
    return (Comp) => {
        return class extends Comp {
            constructor(props) {
                super(props);
                this.ref = null;
            }

            componentDidMount () {
                const dom = this._rendered.dom;
                dom.addEventListener('scroll', this.handleSroll);
            }

            componentWillUnmount () {
                this._rendered.dom.removeEventListener('scroll', this.handleSroll);
            }

            handleSroll () {
                super.onReachBottom();
            }
        };
    };
}